<include file="Public/min-header"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--物流配置 css -start-->
<style>
    ul.group-list {
        width: 96%;min-width: 1000px; margin: auto 5px;list-style: disc outside none;
    }
    ul.group-list li {
        white-space: nowrap;float: left;
        width: 150px; height: 25px;
        padding: 3px 5px;list-style-type: none;
        list-style-position: outside;border: 0px;margin: 0px;
    }
</style>
<!--物流配置 css -end-->

<!--以下是在线编辑器 代码 -->
<script type="text/javascript">
    /*
     * 在线编辑器相 关配置 js
     *  参考 地址 http://fex.baidu.com/ueditor/
     */
    window.UEDITOR_Admin_URL = "__ROOT__/Public/plugins/Ueditor/";
    var URL_upload = "{$URL_upload}";
    var URL_fileUp = "{$URL_fileUp}";
    var URL_scrawlUp = "{$URL_scrawlUp}";
    var URL_getRemoteImage = "{$URL_getRemoteImage}";
    var URL_imageManager = "{$URL_imageManager}";
    var URL_imageUp = "{$URL_imageUp}";
    var URL_getMovie = "{$URL_getMovie}";
    var URL_home = "{$URL_home}";
</script>
<script type="text/javascript" charset="utf-8" src="__ROOT__/Public/plugins/Ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__ROOT__/Public/plugins/Ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="__ROOT__/Public/plugins/Ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">

    var editor;
    $(function () {
        //具体参数配置在  editor_config.js  中
        var options = {
            zIndex: 999,
            initialFrameWidth: "95%", //初化宽度
            initialFrameHeight: 400, //初化高度
            focus: false, //初始化时，是否让编辑器获得焦点true或false
            maximumWords: 99999, removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign'
            , //允许的最大字符数 'fullscreen',
            pasteplain:false, //是否默认为纯文本粘贴。false为不使用纯文本粘贴，true为使用纯文本粘贴
            autoHeightEnabled: true
            /*   autotypeset: {
             mergeEmptyline: true,        //合并空行
             removeClass: true,           //去掉冗余的class
             removeEmptyline: false,      //去掉空行
             textAlign: "left",           //段落的排版方式，可以是 left,right,center,justify 去掉这个属性表示不执行排版
             imageBlockLine: 'center',    //图片的浮动方式，独占一行剧中,左右浮动，默认: center,left,right,none 去掉这个属性表示不执行排版
             pasteFilter: false,          //根据规则过滤没事粘贴进来的内容
             clearFontSize: false,        //去掉所有的内嵌字号，使用编辑器默认的字号
             clearFontFamily: false,      //去掉所有的内嵌字体，使用编辑器默认的字体
             removeEmptyNode: false,      //去掉空节点
             //可以去掉的标签
             removeTagNames: {"font": 1},
             indent: false,               // 行首缩进
             indentValue: '0em'           //行首缩进的大小
             }*/,
            toolbars: [
                ['fullscreen', 'source', '|', 'undo', 'redo',
                    '|', 'bold', 'italic', 'underline', 'fontborder',
                    'strikethrough', 'superscript', 'subscript',
                    'removeformat', 'formatmatch', 'autotypeset',
                    'blockquote', 'pasteplain', '|', 'forecolor',
                    'backcolor', 'insertorderedlist',
                    'insertunorderedlist', 'selectall', 'cleardoc', '|',
                    'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
                    'customstyle', 'paragraph', 'fontfamily', 'fontsize',
                    '|', 'directionalityltr', 'directionalityrtl',
                    'indent', '|', 'justifyleft', 'justifycenter',
                    'justifyright', 'justifyjustify', '|', 'touppercase',
                    'tolowercase', '|', 'link', 'unlink', 'anchor', '|',
                    'imagenone', 'imageleft', 'imageright', 'imagecenter',
                    '|', 'insertimage', 'emotion', 'insertvideo',
                    'attachment', 'map', 'gmap', 'insertframe',
                    'insertcode', 'webapp', 'pagebreak', 'template',
                    'background', '|', 'horizontal', 'date', 'time',
                    'spechars', 'wordimage', '|',
                    'inserttable', 'deletetable',
                    'insertparagraphbeforetable', 'insertrow', 'deleterow',
                    'insertcol', 'deletecol', 'mergecells', 'mergeright',
                    'mergedown', 'splittocells', 'splittorows',
                    'splittocols', '|', 'print', 'preview', 'searchreplace']
            ]
        };
        editor = new UE.ui.Editor(options);
        editor.render("goods_content");  //  指定 textarea 的  id 为 goods_content

    });
</script>


<script type="text/javascript" charset="utf-8" src="__ROOT__/Public/plugins/Ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__ROOT__/Public/plugins/Ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="__ROOT__/Public/plugins/Ueditor/lang/zh-cn/zh-cn.js"></script>

<!--以上是在线编辑器 代码  end-->
<div class="wrapper">
    <include file="Public/breadcrumb"/>
    <section class="content">
        <!-- Main content -->
        <div class="container-fluid">
            <div class="pull-right">
                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
                <a href="javascript:;" class="btn btn-default" data-url="http://www.tp-shop.cn/Doc/Index/article/id/1007/developer/user.html" onclick="get_help(this)"><i class="fa fa-question-circle"></i> 帮助</a>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i>特殊商品详情</h3>
                </div>
                <div class="panel-body">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab_tongyong" data-toggle="tab">通用信息</a></li>
                    </ul>
                    <!--表单数据-->
                    <form method="post" id="addEditSpecGoodsForm">

                        <!--通用信息-->
                        <div class="tab-content">
                            <div class="tab-pane active" id="tab_tongyong">

                                <table class="table table-bordered">
                                    <tbody>
                                    <tr>
                                        <td>商品名称:</td>
                                        <td>
                                            <input type="text" value="{$goodsInfo.goods_name}" name="goods_name" class="form-control" style="width:550px;"/>
                                            <span id="err_goods_name" style="color:#F00; display:none;"></span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>领取要运费的描述:</td>
                                        <td>
                                            <input type="text" value="{$goodsInfo.action_1}" name="action_1" class="form-control" style="width:550px;"/>
                                            <span id="err_action_1" style="color:#F00; display:none;"></span>
                                        </td>
                                    </tr>


                                    <tr>
                                        <td>领取不要运费的描述:</td>
                                        <td>
                                            <input type="text" value="{$goodsInfo.action_2}" name="action_2" class="form-control" style="width:550px;"/>
                                            <span id="err_action_2" style="color:#F00; display:none;"></span>
                                        </td>
                                    </tr>



                                    <tr>
                                        <td>商品简介:</td>
                                        <td>
                                            <textarea rows="3" cols="80" name="content">{$goodsInfo.content}</textarea>
                                            <span id="err_goods_remark" style="color:#F00; display:none;"></span>

                                        </td>
                                    </tr>

                        <!--            <tr>
                                        <td>商品简介:</td>
                                        <td>
                                            <textarea rows="3" cols="80" name="goods_remark">{$goodsInfo.goods_remark}</textarea>
                                            <span id="err_goods_remark" style="color:#F00; display:none;"></span>

                                        </td>
                                    </tr>-->


                                    <tr>
                                        <td>商品所属省份:</td>
                                        <td>
                                            <div class="col-xs-3">
                                                <select name="region_id" id="region_id"  class="form-control" style="width:250px;margin-left:-15px;">
                                                    <option value="0">请选择省份</option>
                                                    <foreach name="regionList" item="v" key="k" >
                                                        <option value="{$v['id']}" <if condition="$v['id'] eq $goodsInfo['region_id']">selected="selected"</if> >
                                                        {$v['name']}
                                                        </option>
                                                    </foreach>
                                                </select>
                                            </div>
                          <!--                  <div class="col-xs-3">
                                                <select name="region_id_2" id="region_id_2"  class="form-control" style="width:250px;margin-left:-15px;">
                                                    <option value="0">请选择城市分类</option>
                                                </select>
                                            </div>
                                            <span id="err_region_id" style="color:#F00; display:none;"></span>-->
                                        </td>
                                    </tr>

                                    <tr>
                                        <td>上传商品图片（在首页显示）:</td>
                                        <td>
                                            <input type="button" value="上传图片(图片规格222*222)"  onclick="GetUploadify(1,'','goods','call_back');"/>
                                            <input type="text" class="input-sm"  name="image1" id="image1" value="{$goodsInfo.image1}"/>
                                            <if condition="$goodsInfo['image1'] neq null">
                                                &nbsp;&nbsp;
                                                <a target="_blank" href="{$goodsInfo.image1}" id="image3">
                                                    <img width="25" height="25" src="/Public/images/image_icon.jpg">
                                                </a>
                                            </if>
                                            <span id="err_original_img" style="color:#F00; display:none;"></span>
                                        </td>
                                    </tr>


                                    <tr>
                                        <td>上传商品图片（在商品详情显示）:</td>
                                        <td>
                                            <input type="button" value="上传图片(图片规格222*222)"  onclick="GetUploadify(1,'','goods','call_back3');"/>
                                            <input type="text" class="input-sm"  name="image2" id="image2" value="{$goodsInfo.image2}"/>
                                            <if condition="$goodsInfo['image2'] neq null">
                                                &nbsp;&nbsp;
                                                <a target="_blank" href="{$goodsInfo.image2}" id="image4">
                                                    <img width="25" height="25" src="/Public/images/image_icon.jpg">
                                                </a>
                                            </if>
                                            <span id="err_original_img" style="color:#F00; display:none;"></span>
                                        </td>
                                    </tr>


                                    </tbody>
                                </table>
                            </div>
                            <!--其他信息-->

                        </div>
                        <div class="pull-right">
                            <input type="hidden" name="id" value="{$goodsInfo.id}">
                            <button class="btn btn-primary" onclick="ajax_submit_form('addEditSpecGoodsForm','{:U('Goods/addEditSpecGoods?is_ajax=1')}');" title="" data-toggle="tooltip" type="button" data-original-title="保存">保存</button>
                        </div>
                    </form><!--表单数据-->
                </div>
            </div>
        </div>    <!-- /.content -->
    </section>
</div>
<script>

    /*
     * 以下是图片上传方法
     */
    // 上传商品图片成功回调函数
    function call_back(fileurl_tmp){
        $("#image1").val(fileurl_tmp);
        $("#image3").attr('href', fileurl_tmp);
    }



    function call_back3(fileurl_tmp)
    {
        $("#image2").val(fileurl_tmp);
        $("#image4").attr('href', fileurl_tmp);

    }
    // 上传商品相册回调函数
    function call_back2(paths){

        var  last_div = $(".goods_xc:last").prop("outerHTML");
        for (i=0;i<paths.length ;i++ )
        {
            $(".goods_xc:eq(0)").before(last_div);	// 插入一个 新图片
            $(".goods_xc:eq(0)").find('a:eq(0)').attr('href',paths[i]).attr('onclick','').attr('target', "_blank");// 修改他的链接地址
            $(".goods_xc:eq(0)").find('img').attr('src',paths[i]);// 修改他的图片路径
            $(".goods_xc:eq(0)").find('a:eq(1)').attr('onclick',"ClearPicArr2(this,'"+paths[i]+"')").text('删除');
            $(".goods_xc:eq(0)").find('input').val(paths[i]); // 设置隐藏域 要提交的值
        }
    }
    /*
     * 上传之后删除组图input
     * @access   public
     * @val      string  删除的图片input
     */
    function ClearPicArr2(obj,path)
    {
        $.ajax({
            type:'GET',
            url:"{:U('Admin/Uploadify/delupload')}",
            data:{action:"del", filename:path},
            success:function(){
                $(obj).parent().remove(); // 删除完服务器的, 再删除 html上的图片
            }
        });
        // 删除数据库记录
        $.ajax({
            type:'GET',
            url:"{:U('Admin/Goods/del_goods_images')}",
            data:{filename:path},
            success:function(){
                //
            }
        });
    }



</script>
</body>
</html>